<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0" />
    <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
    <title>个人信息</title>
    <link rel="stylesheet" type="text/css" href="__CSS__/api.css" />
    <link rel="stylesheet" type="text/css" href="__CSS__/aui.css" />
    <link rel="stylesheet" href="__CSS__/css/ydui.css">
    <link rel="stylesheet" href="__CSS__/css/demo_1.css">
    <style>
        body {
            background-color: #F4F4F4;
        }

        .outer {
            background-color: #FFFFFF;
            height: 64px;
            line-height: 64px;
            margin-top: 10.5px;
        }

        .inner {
            margin: 0 17.5px;
        }

        .avatar {
            width: 45.5px;
            height: 45.5px;
            border-radius: 50%;
            display: inline-block;
            vertical-align: middle;
        }

        .arrow {
            width: 22px;
            height: 64px;
            background: url(__IMG__/right_arrow.png) no-repeat right center;
            background-size: 7.5px 12.8px;
        }

        .outer1 {
            background-color: #FFFFFF;
            height: 45px;
            line-height: 45px;
        }

        input[type="text"] {
            height: 43.9px;
            width: 100%;
            background-color: #fff;
            text-align: right;
            color: #545454;
            font-size: 14px;
            padding-right: 0;
        }

        input::-webkit-input-placeholder {
            color: #999;
            font-size: 14px;
        }

        .outer2 {
            background-color: #FFFFFF;
            height: 123px;
        }

        .title{
            color:#555555;
            font-size:15px;

        }

    </style>
    <style>
        .aui-bar-nav .aui-iconfont {
            position: relative;
            z-index: 20;
            font-size: 14px;
            font-weight: 400;
            color: #FFFFFF;
            line-height: 44px;
        }

        .aui-icon-tu{
            height: 2.2rem;
            width: 44px;
            background: url(__IMG__/back.png) no-repeat center center;
            background-size: 44px 44px;
        }
        .create {
            font-size: 15px;
            color: #FFFFFF;
            width: 100%;
            height: 2.55rem;
            line-height: 2.55rem;
            text-align: center;
            background: -webkit-linear-gradient(right, #F04040, #FF7A7A);
            position: fixed;
            left: 0;
            bottom: 2.5rem;
        }
    </style>
</head>

<body>

<header class="aui-bar aui-bar-nav underLine">
    <a class="aui-pull-left" tapmode="active" onclick="history.go(-1);"> <span class="aui-iconfont aui-icon-tu"> </span> </a>
    <div class="aui-title">个人信息</div>
    <!--<a class="aui-pull-right" >
    <span class="aui-iconfont" tapmode="active" onclick="right()">保存</span>
    </a>-->
</header>
<form id="fabuorder">
<div class="outer">
    <div class="inner underLine flex-wrap">
        <div class="title headerr">头像</div>
        <div class="flex-con"></div>
        <input type="file" accept="image/*" id="fileimg" onChange="previewimg(this)" style="display:none;" name ="file" >
        <div>
            <img src="{$basedata ? $basedata : $userInitInfo.user_image}" class="avatar headerr" />
        </div>
        <div class="arrow headerr"></div>
    </div>
</div>
<div class="outer1">
    <div class="inner underLine flex-wrap">
        <div class="title">姓名</div>
        <div class="flex-con">
            <input type="text" name="user_username" id="nicheng" value="{$userInitInfo.user_username}" placeholder="点击添加" />
        </div>
    </div>
</div>
<div class="outer1">
    <div class="inner underLine flex-wrap" style="text-align: right;">
        <div class="title">性别</div>
        <div class="flex-con" style="float: right;">
            <input type="radio" name="user_gender" value="1" {if $userInitInfo.user_gender == 1}checked{/if} />&nbsp;男
            &nbsp;&nbsp;&nbsp;&nbsp;
            <input type="radio" name="user_gender" value="2" {if $userInitInfo.user_gender == 2}checked{/if} />&nbsp;女
        </div>
    </div>
</div>
    <div class="outer1">
        <div class="inner underLine flex-wrap">
            <div class="title">地址</div>
            <div class="flex-con">
                <input type="text" id="J_Address" name="user_area_str" value="{$userInitInfo.user_area_str}" readonly placeholder="请选择地址" />
            </div>
        </div>
    </div>
    <div class="outer1">
        <div class="inner underLine flex-wrap">
            <div class="title">详细地址</div>
            <div class="flex-con">
                <input type="text" name="user_address" value="{$userInitInfo.user_address}" placeholder="输入详细地址" />
            </div>
        </div>
    </div>
    <div class="outer" onclick="updatePass()">
        <div class="inner underLine flex-wrap">
            <div class="title">修改密码</div>
            <div class="flex-con"></div>
            <div class="arrow"></div>
        </div>
    </div>
    <div class="outer" onclick="loginout()">
        <div class="inner underLine flex-wrap">
            <div class="title">退出登录</div>
            <div class="flex-con"></div>
            <div class="arrow"></div>
        </div>
    </div>
<input type="hidden" id="uid" name="user_id" value="{$userInitInfo.user_id}" />
<input type="hidden" id="areaid" name="areaid" value="" />
<input type="hidden" id="userimg" name="user_image" value="{$basedata ? $basedata : $userInitInfo.user_image}" />
<div class="create" onclick="userinfoAjaxChange()">保存</div>
</form>
</body>
{include file="public/footer" /}
<script type="text/javascript" src="__JS__/qq.js"></script>
<script src="__JS__/js/ydui.citys.js"></script>
<script src="__JS__/js/ydui.js"></script>
<script type="text/javascript">
    $('.headerr').click(function () {
//        location.href = '{:url("My/goImage")}';
        $('#fileimg').click();
    });
    function previewimg(obj){
        var src = window.URL.createObjectURL(obj.files[0]);
        $('.avatar').attr('src',src);
        //buyouhui.js里
        uploadImageCommon('fabuorder','userimg');
    }
    /**
     * 省市区街道四级联动
     * @type {*}
     */
    var $target = $('#J_Address');
    $target.citySelect();
    $target.on('click', function (event) {
        event.stopPropagation();
        $target.citySelect('open');
    });
    $target.on('done.ydui.cityselect', function (ret) {
        $(this).val(ret.country + ' ' + ret.provance + ' ' + ret.city);
        $('#areaid').val(ret.id);
    });
    /**
     * ajax更改
     * */
    function userinfoAjaxChange() {
        $.ajax({
            url: '{:url("My/AjaxUserCenter")}',
            data: $('#fabuorder').serialize(),//
            type: 'POST',
            dataType: 'JSON',
            success: function (data) {
                if(data.status == 200){
                    window.history.back(-1);
                }else {
                    alert(data.msg);
                    return false;
                }
            },
            error: function () {
                alert('Ajax error!');
            }
        })
    }
    function updatePass() {
        location.href = '{:url("My/updatePass")}';
    }
    function loginout() {
        if(confirm('确定退出吗？')){
            location.href = '{:url("Login/loginOut")}';
        }
    }
</script>

</html>
